<?php

  abstract class JooS_Server_Resource_DataNode {
    const DATA_ABSTRACT_NODE = -1;
    const DATA_ELEMENT_NODE = XML_ELEMENT_NODE;
    const DATA_ATTRIBUTE_NODE = XML_ATTRIBUTE_NODE;
    const DATA_TEXT_NODE = XML_TEXT_NODE;
    const DATA_DOCUMENT_NODE = XML_DOCUMENT_NODE;

    private $_nodeName = null;

    private $_nodeValue = null;

    public function __construct($name) {
      $this->_nodeName = $name;
    }
    
    public function __set($name, $value) {
      switch ($name) {
        case "nodeValue":
          $this->_nodeValue = $value;
          break;
      }
    }

    public function __get($name) {
      switch ($name) {
        case "nodeName":
          return $this->_nodeName;
        case "nodeValue":
          return $this->_nodeValue;
        case "nodeType":
          return self::DATA_ABSTRACT_NODE;
        case "childNodes":
          return new ArrayObject(array());
        default:
          return null;
      }
    }

    public function __isset($name) {
      switch ($name) {
        case "nodeName":
        case "nodeValue":
        case "nodeType":
          return true;
          break;
        default:
          return false;
          break;
      }
    }

    public function __unset($name) {
      switch ($name) {
        case "nodeValue":
          $this->_nodeValue = null;
          break;
      }
    }

    protected function getNodeValue() {
      return $this->_nodeValue;
    }

    protected function getNodeName() {
      return $this->_nodeName;
    }
  }

?>